package com.woniuxy.health.auth.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.health.auth.entity.Role;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

public interface RoleMapper extends BaseMapper<Role> {
    @Select("select * from rbac_role rr,rbac_user_role rur where rr.id=rur.roleid and rur.userid=#{id}")
    @Results({
            @Result(id=true,column="id",property="id"),
            @Result(column="id",property="perms",many=@Many(select="com.woniuxy.health.auth.mapper.PermMapper.findPermsById"))
    })
    Role findRoleById(int id);
}